package com.mk.admin.controller;

import com.mk.admin.log.WriteLog;
import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.MenuAddressVo;
import com.mk.admin.service.MenuAddressService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/a/adm/menuAddress")
@Api(tags = "菜单显示地址位置")
public class MenuAddressController {
    @Autowired
    private MenuAddressService menuAddressService;

    @PostMapping("/select")
    public ResultDto select(@RequestBody MenuAddressVo vo) {
        return menuAddressService.select(vo);
    }

    @PostMapping("/add")
    public ResultDto add(@RequestBody MenuAddressVo vo) {
        return menuAddressService.add(vo);
    }

    @PostMapping("/update")
    public ResultDto update(@RequestBody MenuAddressVo vo) {
        return menuAddressService.update(vo);
    }

    @PostMapping("/delete")
    public ResultDto delete(@RequestBody MenuAddressVo vo) {
        return menuAddressService.delete(vo.getId());
    }

    @WriteLog("批量菜单删除")
    @PostMapping("/deleteBatchIds")
    public ResultDto deleteBatchIds(@RequestBody List<MenuAddressVo> list) {
        return menuAddressService.deleteBatchIds(list);
    }

    @PostMapping("/status")
    public ResultDto status(@RequestBody MenuAddressVo vo) {
        return menuAddressService.status(vo.getId());
    }
}
